//
//  ByCellLookDoctorDetail.m
//  jinpuyiyuan_ios
//
//  Created by pro on 2017/12/12.
//  Copyright © 2017年 mc. All rights reserved.
//

#import "ByCellLookDoctorDetail.h"

@implementation ByCellLookDoctorDetail
{
    UIView  *_lineView;
    UILabel *_titleLabel;
    UILabel *_contentLabel;
    NSString *_title;
    NSString *_content;
}
+ (instancetype)cellWithTableView:(UITableView*)tableView andTitle:(NSString *)title andContent:(NSString *)content{
    
    static NSString *cellIdentifier = @"ByCellLookDoctorDetail";
    ByCellLookDoctorDetail *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier andTitle:title andContent:content];
    }
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier andTitle:(NSString *)title andContent:(NSString *)content{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
        _title = title;
        _content = content;
        [self createViews];
    }
    return self;
}

- (void)createViews{
    _lineView = [[UIView alloc] init];
    [self addSubview:_lineView];
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(10));
        make.top.equalTo(@(10));
        make.size.mas_equalTo(CGSizeMake(5, 20));
    }];
    _lineView.backgroundColor = BY_THEME_COLOR;
    
    _titleLabel = [[UILabel alloc] init];
    [self addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_lineView.mas_right).offset(10);
        make.top.equalTo(@(10));
        make.right.equalTo(@(-10));
        make.bottom.equalTo(_lineView.mas_bottom);
    }];
    _titleLabel.font = FONT(16);
    
    _contentLabel = [[UILabel alloc] init];
    [self addSubview:_contentLabel];
    _contentLabel.numberOfLines = 0;
//    CGFloat height = [_content getRectOfStringWithSize:CGSizeMake(SCREEN_WIDTH - 20, MAXFLOAT) font:14].size.height;
    [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_titleLabel.mas_bottom).offset(10);
        make.left.equalTo(_titleLabel.mas_left);
        make.right.equalTo(@(-10));
        make.bottom.equalTo(@(-10));
    }];
    _contentLabel.font = FONT(14);
    
    _titleLabel.text = _title;
    _contentLabel.text = _content;
}

@end
